#include <linux/sched.h>
#include <linux/sched/task.h>
#include <linux/string.h>
#include <linux/init.h>

/*
 *  Ok, this is the main fork-routine.
 *
 * It copies the process, and if successful kick-starts
 * it and waits for it to finish using the VM if required.
 *
 * args->exit_signal is expected to be checked for sanity by the caller.
 */
pid_t kernel_clone(struct kernel_clone_args *args)
{
    struct task_struct *p;
    pid_t nr = 0;
    int trace = 0;
    int err;

    err = copy_process(NULL, trace, -1, args, &p);
    if (err)
    {
        return err;
    }

    wake_up_new_task(p);

    return nr;
}
